package com.example.spring.exercise.service.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author : zhayh
 * @date : 2021-3-29 21:31
 * @description :
 */

@ApiModel(value="学生参数对象")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class StudentParam {
    @ApiModelProperty("学号")
    private String studentCode;
    @ApiModelProperty("姓名")
    private String studentName;
    @ApiModelProperty(value = "班级代码")
    private String classCode;
    @ApiModelProperty(value = "班级名称")
    private String className;
    @ApiModelProperty(value = "年级")
    private Integer classYear;

    public StudentDTO getStudentDTO() {
        BaseClassInfo classInfo = BaseClassInfo.builder()
                .classCode(this.getClassCode())
                .className(this.getClassName())
                .classYear(this.getClassYear())
                .build();

        return StudentDTO.builder()
                .studentCode(this.getStudentCode())
                .studentName(this.getStudentName())
                .classInfo(classInfo)
                .build();
    }
}
